import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from matplotlib.font_manager import FontProperties
import csv

'''读取csv文件'''
def readcsv(files):
    csvfile = open(files, 'r')
    plots = csv.reader(csvfile, delimiter=',')
    x = []
    y = []
    flg = 0
    for row in plots:
        if flg == 0:
            flg = 1
            continue
        y.append((row[2])) 
        x.append((row[1]))
    return x ,y
 
 
#mpl.rcParams['font.family'] = 'sans-serif'
#mpl.rcParams['font.sans-serif'] = 'NSimSun,Times New Roman'


plt.figure()
x1,y1=readcsv("data/experiments/small_loss_trick/test_accuracy__noise_rate___0.0__lnrl___0.csv")
plt.plot(x1, y1, color='black',label='noise rate = 0, lnrl = 0')

x2,y2=readcsv("data/experiments/small_loss_trick/test_accuracy__noise_rate___0.3__lnrl___1.csv")
plt.plot(x2, y2, color='red', label='noise rate = 0.3, lnrl = 1')
 
x3,y3=readcsv("data/experiments/small_loss_trick/test_accuracy__noise_rate___0.3__lnrl___0.csv")
plt.plot(x3, y3, color='green',label='noise rate = 0.3, lnrl = 0')

#plt.xticks(fontsize=16)
#plt.yticks(fontsize=16)

#plt.ylim(0, 16)
#plt.xlim(0, 104800)
plt.xlabel('Steps')
plt.ylabel('Accuracy')
plt.legend(fontsize=16)
plt.show()